package nccloud.sso.filter;

import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.GenericFilter;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@SuppressWarnings("restriction")
public abstract class MyHttpFilter extends GenericFilter {
	private static final long serialVersionUID = 1L;

	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
			throws IOException, ServletException {
		if (!(request instanceof HttpServletRequest)) {
			throw new ServletException(request + " not HttpServletRequest");
		}
		if (!(response instanceof HttpServletResponse)) {
			throw new ServletException(request + " not HttpServletResponse");
		}
		doFilter((HttpServletRequest) request, (HttpServletResponse) response, chain);
	}

	protected void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
			throws IOException, ServletException {
		chain.doFilter(request, response);
	}
}